package com.optitronics.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class GlobalDataModelInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		if (modelAndView != null && !modelAndView.getViewName().contains("redirect:")) {
			modelAndView.getModelMap().addAttribute("defaultPageSize", OptitronicsConstants.PAGE_SIZE);
		}
	}
}
